<template>
  <TbTitle title="十、附件材料" />
  <el-table :header-cell-style="{ background: '#f0f7fc', color: '#000' }" :data="deptTableData" border>
    <el-table-column prop="date" label="序号" type="index" width="180">
    </el-table-column>
    <el-table-column prop="catalogName" label="材料目录名称"> </el-table-column>
    <el-table-column prop="name" label="文件名称"> </el-table-column>
    <el-table-column prop="remark" label="附件描述"> </el-table-column>
    <el-table-column prop="address" label="文件操作">
      <template v-slot="scope">
        <el-button size="small" type="text" icon="el-icon-download" @click="downLoad(scope.row.fileUrl)"
          v-hasPermi="['system:role:edit']">下载</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang="ts">
import { ref, inject } from 'vue'
import { ElLoading } from 'element-plus'
import TbTitle from '@/views/yearCheck/components/TbTitle.vue'

let deptTableData = ref([])
const { getDetailInfo } = inject('getDetailInfo')

getDetailInfo().then(res => {
  deptTableData.value = res.data
})
const downLoad = (url) => {
  const loading = ElLoading.service({
    lock: true,
    text: '下载中...',
    background: 'rgba(0, 0, 0, 0.2)'
  })
  setTimeout(() => {
    window.location.href = url
    loading.close()
  }, 1000)
}
</script>
<style lang="scss" scoped>
.msg-tip {
  padding: 20px 0;
  color: #000;
  font-family: '微软雅黑';
}
</style>
